<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="收款单打印" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintCallBack()");
	}
	function doPrintCallBack(){
		if(popRetVal!=null){
			document.getElementById("noPrinSpan").style.display="none";
			printContent("管理易-收款单","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}",160);
			document.getElementById("noPrinSpan").style.display="";
		}
	}
	function doCancel(){
		window.close();
	}
	function showTotalDiv(cost,remaCost,divId){
		var str="<b>收款合计:</b>"+getBigMoney(""+cost)+" <b>￥</b>"+cost;
		document.getElementById(divId).innerHTML=str;
	}
</script>
</head>
<body style="background-color:#FFFFFF">
<br><br>
<table width="158" align="center" border="1" cellspacing="1" cellpadding="1" class="label_table">
	<tr>
		<td>
			<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="label_table">
				<tr> 
				  <td align="center" class="FontMedium"><b>收据</b></td>
				</tr>
				<tr> 
				  <td>&nbsp;</td>
				</tr>
				<tr>
				  <td class="FontMedium"><b>付款单位：</b>${estName}</td>
				</tr>
				<tr> 
				  <td class="FontMedium"> ----------------------- </td>
				</tr>
				<c:forEach var="item" items="${items}" varStatus="i">
				<tr>
				  <td class="FontMedium"><b>单号：</b>${item[0].businessBillCode}</td>
				</tr>
				<tr> 
				  <td class="FontMedium"><b>联系人：</b>${item[0].linkman}</td>
				</tr>
				<tr>
				  <td class="FontMedium"><b>订货日期：</b><fmt:formatDate value="${item[1]}" pattern="MM-dd HH:mm"/></td>
				</tr>
				<tr>
				  <td class="FontMedium"><b>交货日期：</b><c:if test="${item[2]!=null}"><fmt:formatDate value="${item[2]}" pattern="MM-dd HH:mm"/></c:if></td>
				</tr>
				<tr> 
				  <td class="FontMedium"><b>金额：</b><commonTag:parseBigDecimal source="${item[0].totalCost}" /></td>
				</tr>
				<tr> 
				  <td class="FontMedium"><b>本次收款：</b><commonTag:parseBigDecimal source="${item[0].thisCost}" /></td>
				</tr>
				<tr> 
				  <td class="FontMedium"><b>尚欠款：</b><commonTag:parseBigDecimal source="${item[0].remainCost-item[0].thisCost}" /></td>
				</tr>
				<tr> 
				  <td class="FontMedium"> ----------------------- </td>
				</tr>		
				</c:forEach> 
				
				<tr>
					<td class="FontMedium" id="totalDiv">&nbsp;</td>
				</tr>
				
				<tr> 
				  	<td class="FontMedium"> ----------------------- </td>
				</tr>		
				<tr> 
				  <td class="FontMedium" >${enterpriseInfo.shortName} ${enterpriseInfo.phone} ${enterpriseInfo.address}<br/> 
				  ${bill.createrName} <fmt:formatDate value="${bill.createTime}" pattern="MM-dd HH:mm"/></td>
				</tr>
			  </table>
		</td>
	</tr>
</table>
<table align="center" id="noPrinSpan">
	<tr>
		<td align="center">
			<input type="button" id="printButton" class="Button" value="开始打印" onClick="doPrint();">
			<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
		</td>
	</tr>
</table>
</body>
</html>
<script language="javascript">
	showTotalDiv(${bill.cost},${remaCost},'totalDiv');
</script>